package com.example.demo.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

@Service
public class Strategy {
    // 会自动将项目中的接口下的实现按照名字:实现类注入
    @Autowired
    private final Map<String, IUserService> userServiceStrategyMap = new ConcurrentHashMap<>(2);

    public IUserService getUservice(String name) {
        return userServiceStrategyMap.get(name);
    }
}
